package com.asl.website.common;

/**
 * @author 482944566@qq.com
 * @version 1.0
 * @date 2025-05-21
 */

public enum Language {
    ZH_CN("zh", "简体中文"),
    EN_US("en", "English"),
    DE_DE("de", "Deutsch");

    private final String code;
    private final String name;

    Language(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static Language fromCode(String code) {
        for (Language language : values()) {
            if (language.code.equalsIgnoreCase(code)) {
                return language;
            }
        }
        return ZH_CN; // 默认返回中文
    }
}
